<?php
namespace Admin\Controller;
use Think\Controller;
class OrderController extends AdminController {
    public function index(){

        $this->assign('title','订单列表');
        //查询所有订单
        $orderEvent = A("Order","Event");
        $res = $orderEvent -> queryAllOrder();
        $orderList = $res['list'];
        $show = $res['show'];
        $this->assign("orderList",$orderList);
        $this->assign("page",$show);
        //查询所有优惠券
        $couponList = $orderEvent -> queryAllCoupon();
        $this->assign("couponList",$couponList);
        $this->display('Order/index');
    }

    public function detail ()
    {
        if(IS_GET){
            $this->assign('title','订单详情');
            //查询所有订单
            $orderEvent = A("Order","Event");
            $orderDetailList = $orderEvent -> queryOrderDetail();
//            dump($orderDetailList);die;
            $this->assign("orderDetailList",$orderDetailList);
            $this->display('Order/detail');
        }
    }

    //发货
    public function send ()
    {
        $orderEvent = A("Order","Event");
        $row = $orderEvent -> send();
        if($row > 0){
            $this->success('发货成功');
        }else{
            $this->error('发货失败');
        }
    }

}